package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectEntryApi;
import com.nbsaas.boot.project.api.domain.request.ProjectEntryRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectEntryResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectEntrySimple;
import com.nbsaas.boot.project.data.entity.ProjectEntry;
import com.nbsaas.boot.project.data.repository.ProjectEntryRepository;
import com.nbsaas.boot.project.rest.convert.ProjectEntryEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectEntryResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectEntrySimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   -业务接口实现
 */
@Transactional
@Service
public class ProjectEntryResource extends BaseResource<ProjectEntry, ProjectEntryResponse, ProjectEntrySimple, ProjectEntryRequest> implements ProjectEntryApi {

    @Resource
    private ProjectEntryRepository projectEntryRepository;

    @Override
    public JpaRepositoryImplementation<ProjectEntry, Serializable> getJpaRepository() {
        return projectEntryRepository;
    }

    @Override
    public Function<ProjectEntry, ProjectEntrySimple> getConvertSimple() {
        return new ProjectEntrySimpleConvert();
    }

    @Override
    public Function<ProjectEntryRequest, ProjectEntry> getConvertForm() {
        return new ProjectEntryEntityConvert();
    }

    @Override
    public Function<ProjectEntry, ProjectEntryResponse> getConvertResponse() {
        return new ProjectEntryResponseConvert();
    }


}


